# 有以下列表：list1，正数在前负数在后，正数从小到大，负数从大到小
list1 = [7, -8, 5, 4, 0, -2, -5]
list2 = []
list3 = []
for i in list1:
    if i >= 0:
        list2.append(i)
        list2 = sorted(list2)
    else:
        list3.append(i)
        list3 = sorted(list3,reverse=True)

result = list2 + list3
print(result)


# 这是一个字符串排序，排序规则：小写<大写<奇数<偶数
s = 'asdf234GDSdsdf23'
lower = []
upper = []
oddnum = []
evennum = []

for i in s:
    if i.islower():
        lower.append(i)
    elif i.isupper():
        upper.append(i)
    else:
        if int(i) % 2 == 1:
            oddnum.append(i)
        else:
            evennum.append(i)

result = ''.join(lower + upper + oddnum + evennum)
print(result)
